{% extends "pylucid_admin/base_site.html" %}
{% load i18n %}

{% block content %}
<!-- view_content block -->

{% lucidTag TOC %}

<hr/>

<h2>Cache status</h2>
<p>current pid: {{ pid }}</p>
<table>
    <tr>
    	<th>id</th>
    	<th>item count</th>
    	<th>size</th>
    	<th>last reset</th>
    	<th>global update time</th>
    	<th>cleared</th>
    	<th>init</th>
    	<th>request</th>
    	<th>own cleared</th>
    	<th>ext cleared</th>
    </tr>
{% for item in cache_information %}
    <tr>
    	<td>{{ item.instance.id }}</td>
    	<td>{{ item.length }}</td>
    	<td>{% if item.size %}{{ item.size|filesizeformat }}{% else %}-{% endif %}</td>
    	<td>{{ item.instance.last_reset }} ({{ item.last_reset_datetime }} - since: {{ item.last_reset_datetime|timesince }})</td>
    	<td>
    		{% if item.global_update_time %}
    			{{ item.global_update_time }} ({{ item.global_update_datetime }} - since: {{ item.global_update_datetime|timesince }})
    		{% else %}
    			-
    		{% endif %}
    	</td>
    	<td title="cleard in this thread?">{{ item.cleared|yesno }}</td>
    	<td title="How often __init__ used, should allways be 1!">{{ item.init_counter }}</td>
    	<td title="In how many requests was this cache used?">{{ item.instance.request_counter }}</td>
    	<td title="How often was clear() called in own thread?">{{ item.instance.own_clear_counter }}</td>
    	<td title="How often was clear() from external thread done?">{{ item.instance.ext_clear_counter }}</td>
    </tr>
{% endfor %}
</table>
<table>
    <tr>
        <th colspan="4">FetchFromCacheMiddleware</th>
    </tr>
    <tr>
        <th>local request count</th>
        <th>local cache hit count</th>
        <th>global request count</th>
        <th>global cache hit count</th>
    </tr>
    <tr>
        <td>{{ local_cache_requests|default_if_none:"deactivated" }}</td>
        <td>{{ local_cache_request_hits|default_if_none:"deactivated" }}</td>
        <td>{{ global_cache_requests|default_if_none:"deactivated" }}</td>
        <td>{{ global_cache_request_hits|default_if_none:"deactivated" }}</td>
    </tr>
    <tr>
        <th colspan="4">UpdateCacheMiddleware</th>
    </tr>
    <tr>
        <th>local response count</th>
        <th>local cache hit count</th>
        <th>global response count</th>
        <th>global cache hit count</th>
    </tr>
    <tr>
        <td>{{ local_cache_responses|default_if_none:"deactivated" }}</td>
        <td>{{ local_cache_response_hits|default_if_none:"deactivated" }}</td>
        <td>{{ global_cache_responses|default_if_none:"deactivated" }}</td>
        <td>{{ global_cache_response_hits|default_if_none:"deactivated" }}</td>
    </tr>
</table>

<h3>JS-SHA-Login client-nonce info</h3>
<p>
    <strong>{{ cnonce_count }}x</strong> cnonce ({{ cnonce_size|filesizeformat }}) sended: {{ used_cnonces }}<br />
    (Only valid in this living process instance!)
</p>

<h2>urlpatterns</h2>
<table>
    <tr>
        <th>module / function name</th>
        <th>url name</th>
        <th>url / regex</th>
    </tr>
{% for url_info in urlpatterns %}
    <tr>
        <td>{{ url_info.module }}.<strong>{{ url_info.func_name }}</strong>()</td>
        <td>{{ url_info.url_name }}</td>
        <td title="regex: '{{ url_info.regex }}'">{{ url_info.url }}</td>
    </tr>
{% endfor %}
</table>

<h2>permissions</h2>
<table>
    <tr>
    <th>app_label.codename</th>
    <th>verbose title</th>
    </tr>
{% for permission in permissions %}
    <tr>
    <td><strong>{{ permission.content_type.app_label }}.{{ permission.codename }}</strong></td>
    <td>{{ permission }}</td>
    </tr>
{% endfor %}
</table>

<h2>RequestContext</h2>
{{ request_context }}

<h2>settings</h2>
{{ settings }}

<fieldset><legend>database info</legend>
<ul><h4>database backend information:</h4>
    <li>name: {{ db_backend_name }}</li>
    <li>module: {{ db_backend_module }}</li>
    <li>version: {{ db_backend_version }}</li>
</ul>

<ul><h4>app/model info</h4>
    {% for app_info in apps_info %}
    <li><strong>{{ app_info.app_name }}</strong>
    <ul>
        {% for app_model in app_info.app_models %}
        <li>{{ app_model.name }}</li>
        {% endfor %}
    </ul>
    </li>
    {% endfor %}
</ul>

<ul><h4>database table names</h4>
    {% for table_name in db_table_names %}<li>{{ table_name }}</li>{% endfor %}
</ul>
<ul><h4>django table names</h4>
    {% for table_name in django_tables %}<li>{{ table_name }}</li>{% endfor %}
</ul>
</fieldset>

<h2>request.META</h2>
{{ request_meta }}

<h2>request.session</h2>
{{ request_session }}

<h2>python sys.path</h2>
<ul>
    {% for path in sys_path %}
    <li>{{ path }}</li>
    {% endfor %}
</ul>

<h2>os.environ</h2>
<dl>
    {% for key, value in os_environ.items %}
	  <dt>{{ key }}</dt>
	  <dd>{{ value|escape }}</dd>
    {% endfor %}
</dl>
<!-- view_content block end -->
{% endblock %}